1. Field of the Invention
The present invention relates to virtual machines within computer systems. More specifically, the present invention relates to a method and an apparatus for keeping track of memory usage for tasks in a shared heap in order to control consumption of memory resources.
2. Related Art
The JAVA 2 Platform, Micro Edition (J2ME™) (The terms JAVA™, JVM™, and JAVA VIRTUAL MACHINE™ are trademarks of SUN Microsystems Inc. of Santa Clara, Calif.), has become a very popular software platform for memory-constrained devices such as wireless devices. Motorola, Nokia, NTT DoCoMo, RIM, Siemens, and many other key players in the wireless device industry have shipped a large number of J2ME-enabled devices. In fact, based on some estimates, over 200 million J2ME-enabled mobile phones were shipped in 2003 alone.
A number of techniques to conserve memory have been developed to effectively run applications on such memory-constrained computing devices. One promising technique uses a shared heap to store objects from different tasks (or threads). This technique makes better use of memory space than the conventional technique, which uses a separate heap for each task. However, using a shared heap complicates both garbage-collection and memory-accounting operations.
In computing systems that do not have such memory constraints, data structures such as lookup tables can be used to keep track of per-task memory allocation. However, in memory-constrained computing devices, the high overhead required by such data structures and techniques largely eliminates the space savings gained by using a shared heap.
Hence, what is needed is a method and an apparatus for keeping track of memory usage for tasks in a shared heap without the above-described problems.